Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore/bubble data hash error #835

Conversation

rahulghangas
Copy link
Contributor

Description

Propagate error to user if data being hashed has invalid square size (not a power of 2) while doing basic validation of block.
Returns nil block while making a new block with invalid data.
Returns nil hash for an incorrectly constructed block

Relevant files:

  • types/block.go
  • types/block_test.go

Checks:

  • Test case for returning nil block for invalid data
  • Test case for get nil hash for incorrectly constructed block

Ps: I'm not quite sure about this one, seems like returning a nil Block could be unexpected behaviour in a lot of places

Closes: #728

@rahulghangas rahulghangas marked this pull request as draft August 16, 2022 07:32
@rahulghangas rahulghangas marked this pull request as ready for review August 16, 2022 10:40
@evan-forbes
Copy link
Member

evan-forbes commented Aug 16, 2022

Ps: I'm not quite sure about this one, seems like returning a nil Block could be unexpected behaviour in a lot of places

same tbh, I think I created this issue due to some feedback somewhere, but I wish I had more context into why this should be switched from a panic. Its an unexpected state that means something is seriously wrong, so it feels like panicking is the appropriate thing to do.

I'll dig around and try to find the reason for this. We want to remove the ability to compute shares entirely from tendermint, and completely rely on the app for checking/generating it. In that case in particular, we want to panic if there isn't a hash already set in the block data.

@evan-forbes
Copy link
Member

I think changing this to return an error would be a mistake. Especially since in all use outside of tests that don't in the application, we should never reach the spot that is returning an error. In fact, it seems like a good thing to panic.

thanks for bring this to my attention @rahulghangas and sorry for not clearing out this issue sooner.

I think we should close this unmerged and close the issue as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bubble error instead of panicking when computing the hash of the block data
3 participants